<template>
    <div>
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item :to="{ path: '/start' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>数据列表</el-breadcrumb-item>
        <el-breadcrumb-item>微博列表</el-breadcrumb-item></el-breadcrumb>

    <el-table :data="con" border style="width: 100%;height:450px;overflow:auto;">
    <el-table-column type="index"></el-table-column>
    <!-- <el-table-column label="用户ID" prop="userid" width="100">
    </el-table-column> -->
    <el-table-column label="正文内容" prop="context" width="600">
    </el-table-column>
    <el-table-column label="发布时间" prop="time" width="100">
    </el-table-column>
    <el-table-column label="点赞数" prop="dianzan" width="65">
    </el-table-column>
    <el-table-column prop="pinglun" label="评论数" width="65">
    </el-table-column>
    <el-table-column prop="zhuanfa" label="转发数" width="65">
    </el-table-column>
    <el-table-column label="微博链接" width="130" show-overflow-tooltip>
    <template slot-scope="scope">
    <a :href="scope.row.url" target="_blank" class="buttonText">正文链接</a>
    </template>
    </el-table-column>
    </el-table>
      
<el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="pageCurrent"
      :page-sizes="[10, 25, 50, 100]"
      layout="total, sizes, prev, pager, next, jumper"
      :page-size="pageSize"
      :total="totalCount">
    </el-pagination>
    </div>
</template>

<script>
import axios from 'axios'
export default {
  name: 'Weibo_list',
  data () {
    return {
      con:[],
      totalCount:0,
      pageSize:10,
      pageCurrent:1
    }
  },
  methods: {
    getWeibo_list () {
      const path = `http://127.0.0.1:5000/weibo_list`
      var data = {"pageSize":this.pageSize, "pageCurrent":this.pageCurrent}
      axios.post(path,data)
        .then(response => {
          // alert(response.data.config)
             console.log(this.con)
          this.con = response.data.con.data
          this.pageSize = response.data.con.pageSize
          this.totalCount = response.data.con.totleCount
      
        })
        .catch(error => {
          console.log(error)
        })
    },
       handleSizeChange(val) {
       console.log(val)
       this.pageSize = val
       this.getWeibo_list()
      },
      handleCurrentChange(val) {
         this.pageCurrent = val
        this.getWeibo_list()
      }
  },

  created () {
    this.getWeibo_list()
  }
}
</script>

<style>

</style>
